]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
tests: Add default test setup with common env settings
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Fri, 24 Feb 2023 03:32:08 +0000 (04:32 +0100)
committerMarge Bot <marge-bot@gnome.org>
Sun, 19 Mar 2023 19:40:27 +0000 (19:40 +0000)
Add common test environment variables to a default test setup so that they
don't need to be repeated everywhere.

Also ensures that we're always using the gsettings memory backend to never
interfere with local environment.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2661>

meson.build
src/st/meson.build
tests/meson.build

index 964a9229fb31ad200201edb8bee583a36a847478..56a6b5a5a2979c87ea1ed37a14f4bbf0e51d4752 100644 (file)
@@ -276,6 +276,16 @@ if get_option('extensions_app')
   )
 endif
 
+if get_option('tests')
+  common_test_env = environment()
+  common_test_env.set('GSETTINGS_SCHEMA_DIR', meson.project_build_root() / 'data')
+  common_test_env.set('GSETTINGS_BACKEND', 'memory')
+
+  add_test_setup('default',
+    is_default: true,
+    env: common_test_env,
+  )
+endif
 
 po_dir = join_paths(meson.current_source_dir(), 'po')
 
index 446025734c40f15d592ed10a1bbc980e8f0d8ac6..456860d56aeb0b077f4aafaffd9a63295cbe2a67 100644 (file)
@@ -206,7 +206,6 @@ if get_option('tests')
 
   test('CSS styling support', test_theme,
     workdir: meson.current_source_dir(),
-    env: ['GSETTINGS_BACKEND=memory']
   )
 endif
 
index 2f96a732572830cc3b4de445b69d3784c16b94b7..c0f461f7c1a27ddd4ef5b553fb87bc8415bb75c8 100644 (file)
@@ -18,9 +18,6 @@ dbus_runner = configure_file(
   configuration: dbusrunnerconf,
 )
 
-testenv = environment()
-testenv.set('GSETTINGS_SCHEMA_DIR', join_paths(meson.project_build_root(), 'data'))
-
 tests = [
     'highlighter',
     'insertSorted',
@@ -35,7 +32,6 @@ tests = [
 foreach test : tests
   test(test, run_test,
     args: 'unit/@0@.js'.format(test),
-    env: testenv,
     workdir: meson.current_source_dir())
 endforeach
 
@@ -54,7 +50,7 @@ libgvc_path = fs.parent(libgvc.get_variable('libgvc').full_path())
 
 background_file = files(join_paths('data', 'background.png'))
 
-perf_testenv = testenv
+perf_testenv = environment()
 perf_testenv.set('G_DEBUG', 'fatal-warnings')
 perf_testenv.set('G_MESSAGES_DEBUG', 'GNOME Shell')
 perf_testenv.set('GNOME_SHELL_DATADIR', data_builddir)